﻿//单选
function GetSingleRdoOptions($this) {
    $($this).find('div').addClass('radio-square-checked');
    $($this).siblings().children('div').removeClass('radio-square-checked');
    var cbxVehicle = $($this).attr("answer");
    var othters = $($this).parent().parent().parent().parent().parent().find("ul");
    var answers = "";
    for (var i = 0; i < othters.length; i++) {
        var selectDiv = $(othters[i]).find(".radio-square-checked");
        if (selectDiv.length == 0) {
            answers += "}";
        } else {
            for (var j = 0; j < selectDiv.length; j++) {
                answers += $(selectDiv[j]).parent().attr("answer") + "}";
            }
        }
    }
    answers = answers.substr(0, answers.length - 1);
    $($this).parent().parent().parent().parent().parent().find(".stuAnswer").val(answers);
	alert("调用了");
}

//多选
function GetMultipleRdoOptions($this) {
    $($($this).attr("checked", true));
    $($($this).parent().siblings().find("input").attr("checked", false));
    var cbxVehicle = "";
    //        $('input:radio:checked[class="selected"]').each(function (i) {
    //            cbxVehicle += this.value +"}";
    //        });
    $($this).parent().parent().parent().parent().find("input:checked").each(function (i) {
        cbxVehicle += this.value + "}";
    });
    //alert(cbxVehicle);
    $($($this).parent().parent().parent().parent().find(".stuAnswer")).val(cbxVehicle);
}

//绑定文本框中的学生填写答案
var bindChange = function (e) {
    $(e).unbind("input propertychange");
    $(e).bind("input propertychange", function () {
        //alert(123);
        var getValue = "";
        var thisValue = $(this).val();
        var hddAnswer = $(this).parent().parent().find(".hddAnswer");
        var txtAnswer = $(this).parent().find(":text");
        //$(".hddAnswer").attr("value", getValue);
        for (var i = 0; i < txtAnswer.length; i++) {
            getValue += $(txtAnswer[i]).val() + "}";
        }
        //alert(hddAnswer.val());
        getValue = getValue.substring(0, getValue.length - 1);

        hddAnswer.attr('value', getValue);
        //alert(hddAnswer.val());
    });
};